$(document).ready(function(){
	$('#signInForm').bootstrapValidator({
		feedbackIcons : {
			valid : 'glyphicon glyphicon-ok',
			invalid : 'glyphicon glyphicon-remove',
			validating : 'glyphicon glyphicon-refresh'
		},
		fields : {
			userEmail : {
				trigger : 'blur',
				validators : {
					notEmpty : {
					}
				}
			},
			password : {
				trigger : 'blur',
				validators : {
					notEmpty : {
					},
					stringLength : {
						enabled : true,
						min : 6,
						max : 40
					}
				}
			}
		}
	});
	$('#form-signup').bootstrapValidator({
		feedbackIcons : {
			valid : 'glyphicon glyphicon-ok',
			invalid : 'glyphicon glyphicon-remove',
			validating : 'glyphicon glyphicon-refresh'
		},
		fields : {
			registerEmail : {
				trigger : 'blur',
				validators : {
					notEmpty : {
					},
					remote : {
						type : 'GET',
						message : 'Email is existed in system',
						url : function(validator) {
							return "/user/checkUserEmailExist";
						}
					}
				}
			},
			registerName : {
				trigger : 'blur',
				validators : {
					notEmpty : {
					}
				}
			},
			registerPassword : {
				trigger : 'blur',
				validators : {
					notEmpty : {
					},
					stringLength : {
						enabled : true,
						min : 6,
						max : 40,
						message : 'The Password must be more than 6 and less than 40 characters long'
					},
					identical : {
						field : 'registerRetypePassword',
						message : 'The password and its confirm must be the same'
					}
				}
			},
			registerRetypePassword : {
				validators : {
					notEmpty : {},
					identical : {
						field : 'registerPassword',
						message : 'The password and its confirm must be the same'
					}
				}
			},
			isAgreeTerm : {
				feedbackIcons: false,
				validators : {
					choice : {
						min : 1,
						max : 1,
						message : 'Please agree with the term!'
					}
				}
			}
		}
	});
	$('#form-forgetPwd').bootstrapValidator({
		feedbackIcons : {
			valid : 'glyphicon glyphicon-ok',
			invalid : 'glyphicon glyphicon-remove',
			validating : 'glyphicon glyphicon-refresh'
		},
		fields : {
			forgotEmail : {
				validators : {
					notEmpty : {
					}
				}
			}
		}
	});
	$('#resetPasswordForm').bootstrapValidator({
		feedbackIcons : {
			valid : 'glyphicon glyphicon-ok',
			invalid : 'glyphicon glyphicon-remove',
			validating : 'glyphicon glyphicon-refresh'
		},
		fields : {
			newPassword : {
				trigger : 'blur',
				validators : {
					notEmpty : {
					},
					stringLength : {
						enabled : true,
						min : 6,
						max : 40,
						message : 'The Password must be more than 6 and less than 40 characters long'
					},
					identical : {
						field : 'newPasswordRetype',
						message : 'The password and its confirm must be the same'
					}
				}
			},
			newPasswordRetype : {
				trigger : 'blur',
				validators : {
					notEmpty : {
					},
					identical : {
						field : 'newPassword',
						message : 'The password and its confirm must be the same'
					}
				}
			}
		}
	});
});